﻿function HomeController($scope, LoginFactory, TaskFactory) {
    $scope.isloggedIn = TaskFactory.isloggedIn;

    $scope.Login = function () {
        LoginFactory.Login($scope.user);
    }
    $scope.Logout = function () {
        LoginFactory.Logout();
    }
    $scope.getTasks = function () {
        TaskFactory.GetAllTasks().then(function (data) { console.log(data);})
    }

    if (localStorage.getItem('token')) $scope.getTasks();
}
HomeController.$inject = ['$scope', 'LoginFactory', 'TaskFactory'];